<!--
* @Description: 创建一个DropdownItem组件
* @Author: Rulyc
* @Operating:
-->
<template>
  <li class="lc-dropdown-item" :class="{'is-disabled': disabled}">
    <lc-icon class="lc-dropdown-icon" :class="icon" v-if="icon"></lc-icon>
    <slot></slot>
  </li>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
  name: 'LcDropdownItem',
  props: {
    // 下拉菜单子项是否被禁用
    disabled: {
      type: Boolean,
      required: false
    },
    // 加入图标的名字
    icon: {
      type: String,
      required: false
    }
  }
})
</script>

<style lang="scss">
  .lc-dropdown-item {
    display: block;
    width: 100%;
    padding: 0px 10px;
    height: 35px;
    line-height: 35px;
    clear: both;
    font-weight: 400;
    color: #212529;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    &:hover {
      color: #1e2125;
      background-color: #f8f9fa;
      cursor: pointer;
    }
    &.is-disabled{
      color: #6c757d ;
      pointer-events: none;
      background-color: transparent;
    }
    .lc-dropdown-icon {
      margin-right: 10px;
    }
  }
</style>
